<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> 
 <head>
<base href="<%=basePath%>">
<title>日志下载</title>

<script language="javascript" type="text/javascript">
	//初始化接口下拉框
	function loadApp() {
		$.ajax({
			url : "appManager/queryList",
			type : 'POST',
			async : true,
			dataType : 'json',
			success : function(appList) {
 				//接口下拉框对象
				var appSelect = document.getElementById("appSelect");
				if (appList != null) {
					for (var i = 0; i < appList.length; i++) {
						var option = new Option();
						option.text = appList[i].appname;
						option.value = appList[i].appid;
						appSelect.add(option);
					}
				}
			}
		});
	}

	//加载渠道下拉框
	function loadChannelInfo() {
		//接口下拉框对象
		var appSelect = document.getElementById("appSelect");
		//获取当前选中的接口的值;
		var appid = appSelect.options[appSelect.selectedIndex].value;
		if (appid == "") {
			//渠道下拉框对象
			var channelInfoSelect = document.getElementById("channelInfoSelect");
			channelInfoSelect.options.length = 0; //清空渠道下拉框
			channelInfoSelect.add(new Option("--请选择--", ""));
			return;
		}
		$.ajax({
			url : "channelManage/loadChannelInfoByAppid",
			type : 'POST',
			async : true,
			data : {
				appId : appid
			},
			dataType : 'json',
			success : function(channelInfoList) {
				//渠道下拉框对象
				var channelInfoSelect = document.getElementById("channelInfoSelect");
				channelInfoSelect.options.length = 0; //清空渠道下拉框
				channelInfoSelect.add(new Option("--请选择--", ""));

				for (var i = 0; i < channelInfoList.length; i++) {
					var option = new Option();
					option.text = channelInfoList[i].channelName;
					option.value = channelInfoList[i].channelCode;
					channelInfoSelect.add(option);
				} 
			}
		}); 
	}
	
	 function showDate()    
		{   
			var txtdate= document.getElementById("EntTime").value;
			if(txtdate=="")
			{
					var day = new Date(); 
					var Year = 0; 
					var Month = 0; 
					var Day = 0; 
					var CurrentDate = ""; 
					//初始化时间 
					Year= day.getFullYear();
					Month= day.getMonth()+1; 
					Day = day.getDate(); 
					CurrentDate += Year + "-"; 
					if (Month >= 10 ) 
					{ 
				    	CurrentDate += Month + "-"; 
					}else 
					{ 
					   CurrentDate += "0" + Month + "-"; 
					}if (Day >= 10 ) 
					{ 
					  CurrentDate += Day ; 
					}else 
					{ 
					   CurrentDate += "0" + Day ; 
					} 
			   document.getElementById("EntTime").value=CurrentDate;
			}
		}  
</script>

</head>
<body onload="loadApp()">
	<form action="" id="logform" name="logform" method="post">
		<input id="txtmes" type="hidden" value="${mes}">
		<div class="search">
			&nbsp;&nbsp;<img src="images/search_1.png" />
			<span style="font-size: 12px; font-family: 宋体"> 查询条件</span> &nbsp;&nbsp;
			
			<span style="font-size: 12px; font-family: 宋体"> 应用：</span>
				<select class="search_select_1" id="appSelect" onchange="loadChannelInfo()">
					<option value="">--请选择--</option>
				</select>&nbsp;
			<font style="font-size: 12px; font-family: serif" color="red">*</font>&nbsp;
			
			<span style="font-size: 12px; font-family: 宋体">合作伙伴：</span> 
				 <select class="search_select_1" id="channelInfoSelect">
					<option value="">--请选择--</option>
				</select> &nbsp; 
			
			<span style="font-size: 12px; font-family: 宋体">日志日期：</span> 
			<input id="EntTime" name="lmvo.logDate" readonly="readonly"
				onkeydown="false" value="${lmvo.logDate}"
				onclick="return showCalendar('EntTime', 'y-mm-dd');"
				class="input_time" type="text" />&nbsp;
			<font style="font-size: 12px; font-family: serif" color="red">*</font>&nbsp;&nbsp; 
			
			<span style="font-size: 12px; font-family: 宋体">服务器：</span>
			<select name="lmvo.logServer" class="search_select_1" id="selServer">
			</select>&nbsp; &nbsp;&nbsp;&nbsp;
			
			<input name="button2" type="button" value="打包下载" class="input_custombutton" onclick="downloadzip();">
		</div>
	</form>
</body>
</html>